/*获取代理过程*/
#include <Ice/Ice.h>
#include <Printer.h>
using namespace std;
using namespace Demo;
int
main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectPrx base1 = ic->stringToProxy("SimplePrinter:tcp -h 222.18.151.232 -p 10000");
Ice::ObjectPrx base2 = ic->stringToProxy("Simpleshow:tcp -h 222.18.151.232 -p 10000");
PrinterPrx printer1 = PrinterPrx::checkedCast(base1);                                                
PrinterPrx printer2 = PrinterPrx::checkedCast(base2);                                          
if (!printer2)
   throw "Invalid proxy";
int a,b;
printer1->printString("一个简单的加法计算\n");
printf("请输入两个整数：\n");
cin>>a>>b;
int int2=printer2->getString(a,b);
printf("result:%d\n",int2);
} catch (const Ice::Exception& ex) {
cerr << ex << endl;
status = 1;
} catch (const char* msg) {
cerr << msg << endl;
status = 1;
}
if (ic)
ic->destroy();
return status;
}
